home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dbase / techs.zip / TECH4.ZIP / LABEL2.PRG < prev    next >
Text File  |  1985-11-01  |  2KB  |  78 lines

  1. * Program ...: Label2.PRG
  2. * Author ....: Christopher White
  3. * Date ......: August 1, 1985
  4. * Version....: dBASE III, any version
  5. * Note(s)....: Prints one across shipping type labels within a
  6. *              box.
  7. *
  8. PARAMETERS filename, indx, condition, printer
  9. SET TALK OFF
  10. * ---User definition area.
  11. * ---Define label spacing parameters.
  12. between   = 2
  13. lmargin   = 3
  14. box_h     = 5
  15. box_w     = 55
  16. * ---Define print line expressions.
  17. exp01 = [TRIM( "SHIP TO: " + Shipto + "COMPANY: " + Company )]
  18. exp02 = [TRIM( "COMPANY: " + Company )]
  19. nexp  = 2
  20. * ---Define box characters.
  21. spec_char = "|"
  22. box_line  = "+" + SUBSTR(;
  23.             "----------------------------"+;
  24.             "----------------------------"+;
  25.             "----------------------------",;
  26.             1, box_w - 2) +;
  27.             "+"
  28. * ---Label print area.
  29. * ---Set up database file and FILTER.
  30. USE &filename
  31. IF "" <> indx
  32.    SET INDEX TO &indx
  33. ENDIF
  34. SET FILTER TO &condition
  35. GO TOP
  36. IF printer = "Y"
  37.    SET PRINT ON
  38.    SET CONSOLE OFF
  39. ENDIF
  40. * ---Print labels.
  41. DO WHILE .NOT. EOF()
  42.    * ---Print heading line.
  43.    ? SPACE( lmargin )  + box_line
  44.    * ---Print Detail lines.
  45.    linecnt = "01"
  46.    DO WHILE VAL( linecnt ) <= nexp
  47.       expanded = exp&linecnt
  48.       ? SPACE( lmargin ) + spec_char + &expanded;
  49.              + SPACE( ( box_w - 2 );
  50.              - LEN( &expanded ) ) + spec_char
  51.       linecnt = SUBSTR( STR( VAL( linecnt ) + 101 ,3) , 2, 2 )
  52.    ENDDO
  53.    * ---Printing trailing lines.
  54.    pline = 1
  55.    DO WHILE pline < ( box_h - nexp )
  56.       ? SPACE( lmargin ) + spec_char;
  57.              + SPACE( box_w - 2 ) + spec_char
  58.       pline = pline + 1
  59.    ENDDO
  60.    * ---Print footing line.
  61.    ? SPACE( lmargin ) + box_line
  62.    * ---Skip lines between labels.
  63.    pline = 1
  64.    DO WHILE pline < ( box_h - nexp )
  65.       ?
  66.       pline = pline + 1
  67.    ENDDO
  68.    SKIP
  69. ENDDO
  70. IF printer = "Y"
  71.    * ---Flush print buffer.
  72.    ?  
  73.    SET PRINT OFF
  74.    SET CONSOLE ON
  75. ENDIF
  76. CLOSE DATABASES
  77. RETURN
  78. * EOP Label2.PRG